<!DOCTYPE html>
<html>

<head>
    {% load static %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理员用户信息管理</title>

    <link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
    <link rel="stylesheet" href="{% static 'css/admin_userManagement.css' %}">
    <script src="{% static 'jquery/jquery-3.2.1.js' %}"></script>
    <script src="{% static 'layer/layer.js' %}"></script>
    <script src="{% static 'layui/layui.js' %}"></script>
</head>

<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">智慧教室管理系统</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
                         class="layui-nav-img">
                    <span id="username">{{ name }}</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="/user_center/">个人中心</a></dd>
                    <dd><a href="/logout/">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>

     <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="/teareserve/">教师预约</a>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="/teacher_attendance_index/">学生出勤管理</a>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="/table/">查看课表</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">

        <fieldset class="layui-elem-field">
            <table border="1" align="2" align="center" cellspacing="10" cellpadding="10" lay-filter="classScheduling"
                   class="layui-table">
                <thead>
                    <tr>
                        <th lay-data="{field:'week', width:80}">星期</th>
                        <th lay-data="{field:'mon'}">星期一</th>
                        <th lay-data="{field:'tue'}">星期二</th>
                        <th lay-data="{field:'wed'}">星期三</th>
                        <th lay-data="{field:'thu'}">星期四</th>
                        <th lay-data="{field:'fri'}">星期五</th>
                        <th lay-data="{field:'sat'}">星期六</th>
                        <th lay-data="{field:'sun'}">星期日</th>
                    </tr>
                </thead>
                <tbody>
                {% for row in table %}
                    <tr>
                    {% for course in row %}
                        <td>{{ course|safe }}</td>
                    {% endfor %}
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </fieldset>
    </div>

</div>

<script src="{% static 'layui/layui.js' %}"></script>
<script>
    //JS
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element,
            layer = layui.layer,
            util = layui.util,
            $ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function (othis) {
                layer.msg('展开左侧菜单的操作', {
                    icon: 0
                });
            },
            menuRight: function () {
                layer.open({
                    type: 1,
                    content: '<div style="padding: 15px;">处理右侧面板的操作</div>',
                    area: ['260px', '100%'],
                    offset: 'rt' //右上角
                    ,
                    anim: 5,
                    shadeClose: true
                });
            }
        });

    });
    var table = layui.table;

    //上传文件


    //转换静态表格
    table.init('classScheduling', {
        // height: 315 //设置高度
        //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
        //支持所有基础参数
    });
    //注意：折叠面板 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function () {
        var element = layui.element;

        //…
    });
</script>
<script>
    //判断当前登录的是谁
    $.ajax({
                url: "/user/",
                method: "get",
                success: function (response) {
                    if(response.msg === 'ok'){
                        $("#username").html(response.data.username)
                    } else {
                        window.location.href = '/login'
                    }
                },
                error: function (err) {
                    window.location.href = '/login'
                }
        })
</script>

</body>

<style>
    .layui-table-cell {
        height: auto;
    }
</style>

</html>